package com.ltf.service;

import com.ltf.dao.TaskDao;
import com.ltf.dao.TermDao;
import com.ltf.entity.Task;
import com.ltf.entity.Term;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TaskServiceImpl implements TaskService{
    @Autowired
    TaskDao taskDao;
    @Autowired
    TermDao termDao;
    @Override
    public List<Task> findAll() {
        return this.taskDao.findAll();
    }

    @Override
    public int add(Task task) {
        Term term = termDao.findByState();
        task.setTerm(term);
        return this.taskDao.add(task);
    }

    @Override
    public int del(Integer kid) {
        return this.taskDao.del(kid);
    }

    @Override
    public List<Task> findByClzno(String clzno) {
        return this.taskDao.findByClzno(clzno);
    }

    @Override
    public List<Task> findByTid(Integer tid) {
        return this.taskDao.findByTid(tid);
    }


}
